﻿<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link type="text/css" href="../Layui/css/layui.css" rel="stylesheet" media="all">
    <script type="text/javascript" src="../Htc/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="../Htc/Enter2Tab.js"></script>
    <script type="text/javascript" src="../Htc/CustomForm.js?11"></script>
    <script type="text/javascript" src="../Layui/layui.js"></script>
</head>
<body>
    <form id="form1" class="layui-form">
        <div class="poppan" style="padding:10px;">
            <table style="width:100%;">
                <tr>
                    <td class="site-content">   <h1 class="layui-text">上传导入</h1></td>
                    <td class="site-content">   <h1 class="layui-text"> 导入预览</h1></td>
                </tr>
            </table>

            <div class="layui-progress">
                <div class="layui-progress-bar" lay-percent="50%"></div>
            </div>
            <div class="site-content" style="margin-top:10px; margin-left:10px;">
                <ul class="layui-timeline">
                    <li class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                        <div class="layui-timeline-content layui-text">
                            <h3 class="layui-timeline-title">下载模板,填入收集的学员信息</h3>
                            <p>
                                <a href="../Resource/Customer.xls" class="layui-btn layui-btn-normal">　下载　</a>
                            </p>
                        </div>
                    </li>
                    <li class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                        <div class="layui-timeline-content layui-text">
                            <h3 class="layui-timeline-title">选择导入渠道</h3>

                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">渠道来源</label>
                            <div class="layui-input-inline">
                                <select name="_custFromId" id="_custFromId">
                                    @foreach (var dr in ViewBag.CustFrom)
                                    {
                                        <option value="@dr.Key">@dr.Value</option>
                                    }
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">来源备注</label>
                            <div class="layui-input-inline">
                                <input type="text" name="_custFromRemark" id="_custFromRemark" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </li>
                    <li class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                        <div class="layui-timeline-content layui-text">
                            <h3 class="layui-timeline-title">选择文件上传</h3>                                                
                            <div class="layui-card-body">
                                <div class="layui-upload-drag" id="upload">
                                    <i class="layui-icon"></i>
                                    <p>点击上传，或将文件拖拽到此处</p>
                                </div>
                            </div>                          
                        </div>
                    </li>
                    <li class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                        <div class="layui-timeline-content layui-text">
                            <div class="layui-timeline-title">导入预览</div>
                        </div>
                        <div>
                            <a href="javascript:Next()" class="layui-btn layui-btn-normal">　下一步　</a>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </form>

    <script>
        var file = "";
        layui.use(['element', 'table', 'layer', 'laypage', 'form', 'laydate','upload'], function () {
            layui.upload.render({
                elem: '#upload', //绑定元素
                accept: 'file',
                exts: 'xls|xlsx',
                field:'uploadfile',
                url: '../Main/Upload/', //上传接口
                done: function (data) {
                    if (data.code == "0000") {
                        file = data.data;                                           
                        $("#upload").html(file.split('|')[0]);
                    }
                    else
                        layui.layer.msg(data.message);
                },
                error: function () {
                        //请求异常回调
                }
            });
        });

        function Next() {
            location.href = "../Customer/Import1?custFromId=" + $("#_custFromId").val() + "&custFromRemark=" + escape($("#_custFromRemark").val()) + "&file=" + escape(file);
        }
    </script>

</body>
</html>
        